/**
  ******************************************************************************
  * @file    cam.h
  * @author  Amaseing team
  * @version V1.0.0
  * @date    21-november-2013
  * @brief   Cam
  *         
  ******************************************************************************  
  */ 
#ifndef _CAM_H_
#define _CAM_H_

/* Public includes -----------------------------------------------------------*/
#include <stm32f4xx.h>
#include "image.h"

/* Public defines ------------------------------------------------------------*/
// Define here the cam resolution, 
// Depending on this, settings are selected in file ov9655settings.h
//
// Possible resolutions are:
// - 1280 x 1024
// -  640 x 480
// -  320 x 240
// - 	160 x 120

#define CAM_WIDTH 	(1280)		//1280
#define CAM_HEIGHT 	(1024)    //1024

#ifndef CAM_WIDTH
	#define CAM_WIDTH (320)
#endif
#ifndef CAM_HEIGHT
	#define CAM_HEIGHT (240)
#endif
/* Public functions ----------------------------------------------------------*/
// Init cam
void camInit(void);

// Sets the ROI of the camera view. Ignored if the ROI sticks outside camera view.
// Width need to be a multiple of 4, bits [1:0] are ignored. Max = CAM_WIDTH
// Heigth need to be at least 1 or higher. Max = CAM_HEIGHT
//
// Examples: 
// - camSetROI(x,y,x2,y2)		x2 pixel(s) width, y2 line(s)
//   Area from (x,y)(x+x2-1,y+y2-1) 		of orginal; 	(0,0)(CAM_WIDTH,CAM_HEIGHT)
//
// - camSetROI(0,0,8,1)		8 pixels width, 1 line
//   Area from (0,0)(0+8-1,0+1-1) 			of orginal; 	(0,0)(CAM_WIDTH,CAM_HEIGHT)
//
// - camSetROI(0,119,320,1)		320 pixels width, 1 line
//   Area from (0,119)(0+320-1,119+1-1) of orginal; 	(0,0)(CAM_WIDTH,CAM_HEIGHT)
//
void camSetROI(unsigned int x, unsigned int y, unsigned int width, unsigned int height);

// Capture a camera frame and returns the start address
// Returns address on success, otherwise NULL (0).
image_t* camGetFrame(void);
#endif


